<?php
require 'key.php';

$data=parse_ini_file('./data.ini');

$query=$_SERVER['QUERY_STRING'];
parse_str($query,$queryResult);

if(safeVerify($queryResult))
{
    $user=$queryResult['user'];
    $video=$queryResult['video'];
    $time=$queryResult['time'];

    $varName=joint_code($user,$video);
    $key=$time.$additionKey;

    if($data[$varName]=='1')
    {
        $ciphertext = openssl_encrypt($varName, 'DES-ECB', $key, OPENSSL_RAW_DATA);
        $ciphertext = base64_encode($ciphertext);
        echo $ciphertext;
    }
}
